package cn.sumpu.app.wlcity.dao.impl;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import cn.sumpu.app.wlcity.dao.SmsLogDao;
import cn.sumpu.app.wlcity.domain.SmsLog;
import cn.sumpu.app.wlcity.exception.AppBusinessException;

public class SmsLogDaoImpl extends SqlMapClientDaoSupport implements SmsLogDao {

	private static Logger logger = LoggerFactory.getLogger(SmsLogDaoImpl.class);

	@Override
	public void insert(SmsLog smsLog) throws AppBusinessException {
		try {
			getSqlMapClientTemplate().insert("SmsLog.insert", smsLog);
		} catch (DataAccessException e) {
			if (logger.isErrorEnabled()) {
				logger.error("Write database failure.", e);
			}
			throw new AppBusinessException("Write database failure.", e);
		}
	}

}
